<div class="yearworkarea">
    <div *ngIf="step1" class="yearworkwrap">
        <div class="p10">
            <button nz-button nzType="primary" (click)="yearShowModal()" nzGhost><i nz-icon
                    nzType="plus"></i>新编</button>
            <button nz-button nzType="primary" (click)="operateShowModal('1','提报')" nzGhost><i nz-icon
                    nzType="check"></i>提报</button>
            <button nz-button nzType="primary" (click)="operateShowModal('','删除')" nzGhost><i nz-icon
                    nzType="delete"></i>删除</button>
        </div>
        <div class="table-nzbordered">
            <nz-table #rowSelectionTable [nzScroll]="lockHeadScroll" [nzLoadingDelay]="1000" [nzShowPagination]="false"
                [nzFrontPagination]="false" [nzPageSize]="yearpageValue" [nzData]="data"
                (nzCurrentPageDataChange)="currentPageDataChange($event)" (nzPageIndexChange)="refreshStatus()"
                (nzPageSizeChange)="refreshStatus()">
                <thead>
                    <tr>
                        <th nzWidth="50px" nzAlign="center" nzShowCheckbox [(nzChecked)]="allChecked"
                            [nzIndeterminate]="indeterminate" (nzCheckedChange)="checkAll($event)"></th>
                        <th nzWidth="100px" nzAlign="center">序号</th>
                        <th nzWidth="25%" nzAlign="center">年表</th>
                        <th nzAlign="center">状态</th>
                        <th nzWidth="25%">审批意见</th>
                        <th nzWidth="200px" nzAlign="center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let data of rowSelectionTable.data;index as i" [tabindex]="i">
                        <td nzAlign="center" nzShowCheckbox [(nzChecked)]="data.checked" [nzDisabled]="data.disabled"
                            (nzCheckedChange)="refreshStatus()"></td>
                        <td style="display:none">{{data.N_ID}}</td>
                        <td nzAlign="center">{{data.RN}}</td>
                        <td>{{data.SHOWNAME}}</td>
                        <td nzAlign="center">
                            <span nzTooltipTitle="查看审批流程信息" nzTooltipPlacement="bottom" nz-tooltip class="flowInfo"
                                (click)="statusShowModal(data.N_ID)">{{data.STATUS}}</span>
                        </td>
                        <td>{{data.APP_COMMENTS}}</td>
                        <td nzAlign="center">
                            <button *ngIf="data.VC_STATUS == 0 || data.VC_STATUS == 3;else anothericon"
                                (click)="startstep(rowpageTable2,data.N_YEAR,'edit',listpageValue,'',data.VC_LINE$TYPE,data.N_ID)"
                                nz-button nzType="primary" nzSize="small" nzGhost>
                                <i nz-icon nzType="tool"></i>{{data.SHOWCOL}}
                            </button>
                            <ng-template #anothericon>
                                <button
                                    (click)="startstep(rowpageTable2,data.N_YEAR,'view',listpageValue,'',data.VC_LINE$TYPE,data.N_ID)"
                                    nz-button nzType="primary" nzSize="small" nzGhost>
                                    <i nz-icon nzType="file-text"></i>{{data.SHOWCOL}}
                                </button>
                            </ng-template>
                        </td>
                    </tr>
                </tbody>
            </nz-table>
        </div>
        <div class="pageWrap">
            每页
            <nz-select [(ngModel)]="yearselectedValue" (ngModelChange)="yearselectedChange()">
                <nz-option nzValue="10" nzLabel="10"></nz-option>
                <nz-option nzValue="50" nzLabel="50"></nz-option>
                <nz-option nzValue="100" nzLabel="100"></nz-option>
                <nz-option nzValue="200" nzLabel="200"></nz-option>
            </nz-select> 条&nbsp;&nbsp;&nbsp;总共<span class="pageTotal">{{pageTotal1}}</span>条
        </div>
        <div class="pageInation">
            <nz-pagination [nzPageSize]="yearselectedValue" [nzPageIndex]="pageIndexTable1" [nzTotal]="rowTotalTable1"
                (nzPageIndexChange)="rowChangeTable1($event)"></nz-pagination>
        </div>
    </div>

    <div *ngIf="step2" class="yearworkwrap">
        <div class="p10">
            <button nz-button nzType="primary" (click)="backstep()" nzGhost><i nz-icon nzType="rollback"></i>返回</button>
            <button *ngIf="addWorkButton" nz-button nzType="primary" (click)="addWorkShowModal()" nzGhost><i nz-icon
                    nzType="plus"></i>新增作业</button>
            <!-- <span style="margin-left:8px">
                <app-yearfilter [yesorno]="'1'" (childOuter)="yearFilterData($event)"></app-yearfilter>
            </span> -->
        </div>
        <div class="table-nzbordered">
            <nz-table #rowSelectionTable2 [nzScroll]="lockHeadScroll" [nzLoadingDelay]="1000" [nzShowPagination]="false"
                [nzFrontPagination]="false" [nzPageSize]="listpageValue" [nzData]="data2">
                <thead>
                    <tr>
                        <th nzAlign="center" nzWidth="60px">序号</th>
                        <th nzAlign="center" nzWidth="100px">作业类型</th>
                        <th nzAlign="center">作业项目</th>
                        <th nzAlign="center" nzWidth="100px">周期</th>
                        <th nzAlign="center" nzWidth="100px">单位</th>
                        <th nzAlign="center" nzWidth="100px">工作数量</th>
                        <th nzAlign="center" nzWidth="100px">合计工时</th>
                        <th nzAlign="center" nzWidth="300px">工作设备名称</th>
                        <th nzAlign="center" nzWidth="300px">备注</th>
                        <!-- <th nzAlign="center" nzWidth="80px">状态</th> -->
                        <th nzAlign="center" nzWidth="150px">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <ng-container *ngFor="let data of rowSelectionTable2.data;index as i">
                        <tr *ngIf="data.RN" [tabindex]="i">
                            <td nzAlign="center">{{data.RN}}</td>
                            <td style="display:none">{{data.N_DID}}</td>
                            <td [attr.rowspan]="data.VC_CLASS_Count" *ngIf="data.VC_CLASS_Start">
                                {{data.VC_CLASS}}
                            </td>
                            <td [attr.rowspan]="data.VC_ITEM$NAME_Count" *ngIf="data.VC_ITEM$NAME_Start">
                                {{data.VC_ITEM$NAME}}
                            </td>
                            <td nzAlign="center" [attr.rowspan]="data.VC_RECYCLE$DESC_Count"
                                *ngIf="data.VC_RECYCLE$DESC_Start">
                                {{data.VC_RECYCLE$DESC}}
                            </td>
                            <td nzAlign="center" [attr.rowspan]="data.VC_UNIT_Count" *ngIf="data.VC_UNIT_Start">
                                {{data.VC_UNIT}}
                            </td>
                            <td nzAlign="center" [attr.rowspan]="data.DEVSUMS_Count" *ngIf="data.DEVSUMS_Start">
                                {{data.DEVSUMS}}
                            </td>
                            <td nzAlign="center">{{data.TOTLEWT}}</td>
                            <td>{{data.DEVS}}</td>
                            <!--根据作业项目来合并备注-->
                            <td [attr.rowspan]="data.VC_ITEM$NAME_Count" *ngIf="data.VC_ITEM$NAME_Start">
                                <div [innerHTML]="data.REVC_NOTE"></div>
                            </td>
                            <!--根据作业项目来合并操作-->
                            <td nzAlign="center" [attr.rowspan]="data.VC_ITEM$NAME_Count"
                                *ngIf="data.VC_ITEM$NAME_Start">
                                <ng-container *ngIf="data.VC_STATUS == 0 || data.VC_STATUS == 3;">
                                    <button (click)="maintain(i,data.N_ITEM$ID,data.N_ID,'edit',data.VC_ORGID)"
                                        nz-button nzType="primary" nzSize="small" nzGhost>
                                        <i nz-icon nzType="tool"></i>{{data.SHOWCOL}}
                                    </button>
                                    <button nz-button nzType="primary" nzSize="small" nzGhost nz-popconfirm
                                        nzPopconfirmTitle="删除作业项目而不是删除车站，确认删除吗？" (nzOnConfirm)="deleteItem(data.N_DID)">
                                        <i nz-icon nzType="delete"></i>删除
                                    </button>
                                </ng-container>
                                <ng-container *ngIf="data.VC_STATUS != 0 && data.VC_STATUS != 3;">
                                    <button (click)="maintain(i,data.N_ITEM$ID,data.N_ID,'view',data.VC_ORGID)"
                                        nz-button nzType="primary" nzSize="small" nzGhost>
                                        <i nz-icon nzType="file-text"></i>{{data.SHOWCOL}}
                                    </button>
                                </ng-container>
                            </td>
                        </tr>
                    </ng-container>
                </tbody>
            </nz-table>
        </div>
        <div class="pageWrap">
            每页
            <nz-select [(ngModel)]="listselectedValue" (ngModelChange)="listselectedChange()">
                <nz-option nzValue="10" nzLabel="10"></nz-option>
                <nz-option nzValue="50" nzLabel="50"></nz-option>
                <nz-option nzValue="100" nzLabel="100"></nz-option>
                <nz-option nzValue="200" nzLabel="200"></nz-option>
            </nz-select> 条&nbsp;&nbsp;&nbsp;总共<span class="pageTotal">{{pageTotal2}}</span>条
        </div>
        <div class="pageInation">
            <nz-pagination [nzPageSize]="listselectedValue" [nzPageIndex]="pageIndexTable2" [nzTotal]="rowTotalTable2"
                (nzPageIndexChange)="rowChangeTable2($event)"></nz-pagination>
        </div>
    </div>

    <div [ngStyle]="{'display':showstep3}" class="yearworkwrap">
        <app-maintenance #mtecom (saved)="mainBackPage()" (backstep)="backstep2()"></app-maintenance>
    </div>

    <app-addyear *ngIf="addYearVisible" (yearCloseModal)="yearHideModal()" (yearReloadData)="reload()"></app-addyear>

    <app-operateyear *ngIf="operateYearVisible" [operateType]="operateyearData.type"
        [operateTitle]="operateyearData.title" [operateData]="operateyearData.data"
        (operateCloseModal)="operateHideModal()" (operateReloadData)="reload()"></app-operateyear>

    <app-ststusyear *ngIf="statusYearVisible" [statusType]="'year'" [statusNid]="statusYearNid"
        (statusCloseModal)="statusHideModal()">
    </app-ststusyear>

    <app-addwork *ngIf="addWorkVisible" [addWorkYearPlaceId]="'0'" [addWorkYearNid]="statusYearNid"
        (addWorkCloseModal)="addWorkHideModal()" (addWorkReloadData)="backstep2()">
    </app-addwork>
</div>